function get_Course_Condition(a) {
    if(a==1)
    {

            post("http://"+ip+"/data/request/get-course-condition", {
                refer: $("#finish-button").text(),
                courseName: $("#course-button").text(),
                userFlag: a
            }, function (data) {
                if (data.code == 200) {
                    $("#UFA_tr").show();
                    $.each(data.t, function (a, b) {
                        var trs = $("#UFA_tr").clone(true);
                        trs.attr('id', 'UFA_tr' + a)
                        trs.children().eq(0).text(b.aid)
                        trs.children().eq(1).text(b.courseName)
                        trs.children().eq(2).text(b.assignmentName)
                        trs.children().eq(3).text(b.detail)
                        trs.children().eq(4).text(b.isFinish)
                        trs.children().eq(5).children().eq(0).attr('onclick', 'upload(' + a + ')')
                        $("#UFA_tb").append(trs);
                        $("#UFA_tb").append(trs);
                    })
                    $("#UFA_tr").hide();

                } else {
                    alert(data.reason)
                }


            })


        }

    else if(a==10) {
        post("http://"+ip+"/data/request/get-class-course-condition", {
            refer: $("#finish-button").text(),
            cno: $("#cno").text(),
            courseName: $("#course-button").text(),
            userFlag: a
        }, function (data) {
            if (data.code == 200) {

                    $("#course-show").text(data.t[0].courseName)
                    $("#UFA_tr").show();
                    $.each(data.t, function (a, b) {
                        var trs = $("#UFA_tr").clone(true);
                        trs.attr('id', 'UFA_tr' + a)
                        trs.children().eq(0).text(b.sid)
                        trs.children().eq(1).text(b.studentName)
                        trs.children().eq(2).text(b.isFinish)
                        trs.children().eq(3).children().eq(0).attr('onclick', 'checkAssignment(' + a + ')')
                        $("#UFA_tb").append(trs);
                    })
                    $("#UFA_tr").hide();


            } else {
                alert(data.reason)
            }


        })
    }
}



function get_Student_Course_condition(sid)
{
    post("http://"+ip+"/data/request/get-student-course-condition", {
        refer: $("#finish-button").text(),
        sid: sid,
        courseName: $("#course-button").text(),
    }, function (data) {
        if (data.code == 200) {
            $("#UFA_tr").show();
            $.each(data.t, function (a, b) {
                var trs = $("#UFA_tr").clone(true);
                trs.attr('id', 'UFA_tr' + a)
                trs.children().eq(0).text(b.aid)
                trs.children().eq(1).text(b.courseName)
                trs.children().eq(2).text(b.assignmentName)
                trs.children().eq(3).text(b.detail)
                trs.children().eq(4).text(b.isFinish)
                trs.children().eq(5).children().eq(0).attr('onclick', 'upload(' + a + ')')
                $("#UFA_tb").append(trs);
                $("#UFA_tb").append(trs);
            })
            $("#UFA_tr").hide();

        } else {
            alert(data.reason)
        }


    })

}
function getAllCourse()
{
    post("http://"+ip+"/data/request/getAllCourse", {

    }, function (data) {
        if (data.code == 200&&data.t!=null) {

            $("#course-button").text(data.t[0])
            var trs1 = $("#course-select").clone(true);
            $("#course-select").remove()
            $.each(data.t, function (a, b) {
                var trs = trs1.clone(true);
                trs.attr('id', 'course-select' + a)
                trs.text(b)
                trs.attr('href', 'javascript:changeCourse(' + a+','+10 + ')')
                $("#course-list").append(trs);
            })

               get_Course_Condition(10);


        }
        else
        {
            alert(data.reason)
        }


    })
}
function getCourseByStudent()
{
    post("http://"+ip+"/data/request/getCourseByStudent", {

    }, function (data) {
        if (data.code == 200&&data.t!=null) {

            $("#course-button").text(data.t[0])
            var trs1 = $("#course-select").clone(true);
            $("#course-select").remove()
            $.each(data.t, function (a, b) {
                var trs = trs1.clone(true);
                trs.attr('id', 'course-select' + a)
                trs.text(b)
                trs.attr('href', 'javascript:changeCourse(' + a+','+1 + ')')
                $("#course-list").append(trs);
            })

            get_Course_Condition(1);


        }
        else
        {
            alert(data.reason)
        }


    })
}

function changeCourse(a,userFlag)
{
    $("#course-button").text($("#course-select"+ a).text());
    $("#UFA_tr").show();
    var trs=$("#UFA_tr").clone(true);
    $("#UFA_tb").empty();
    $("#UFA_tb").append(trs);
    get_Course_Condition(userFlag);
    $("#UFA_tr").hide();
}
function changeFinish(a,userFlag)
{
    $("#finish-button").text(a);
    $("#UFA_tr").show();
    var trs=$("#UFA_tr").clone(true);
    $("#UFA_tb").empty();
    $("#UFA_tb").append(trs);
    get_Course_Condition(userFlag);
    $("#UFA_tr").hide();
}

//初始化个人信息


